<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增从业人员信息')" />
    <th:block th:include="include :: jasny-bootstrap-css"/>
    <th:block th:include="include :: datetimepicker-css" />
    <th:block th:include="include :: ztree-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-staff-add" th:object="${unit}">
            <input name="zagldwbm" th:value="${unit.zagldwbm}" type="hidden">
            <input name="djdwGajgjgdm" th:field="*{djdwGajgjgdm}" type="hidden">
            <input name="sssj" th:field="*{sssj}" type="hidden">
            <input name="ssfxj" th:field="*{ssfxj}" type="hidden">
            <input name="sspcs" th:field="*{sspcs}" type="hidden">
            <input name="sszrq" th:field="*{sszrq}" type="hidden">
            <input name="zxdhzb" th:field="*{zxdhzb}" type="hidden">
            <input name="zxdzzb" th:field="*{zxdzzb}" type="hidden">
            <input name="sssqjwwgDzbm" th:field="*{sssqjwwgDzbm}" type="hidden">
            <input name="sssqjcwgDzbm" th:field="*{sssqjcwgDzbm}" type="hidden">
            <input name="ssjd" th:value="${unit.ssjlxxqDzbm}" type="hidden">
            <div class="form-group">
                <label class="col-sm-3 control-label">头像：</label>
                <div class="col-sm-8 fileinput fileinput-new" data-provides="fileinput" style="text-align: center; margin-bottom: 0;">
                    <div class="fileinput-preview thumbnail" data-trigger="fileinput" style="width: 200px; height: 150px; margin-right: 10px;"></div>
                    <span class="btn btn-white btn-file"><span class="fileinput-new">选择图片</span><span class="fileinput-exists">更改</span><input name="photo" type="hidden" value=""><input id="williamYe" type="file"></span>
                    <a href="#" class="btn btn-white fileinput-exists" data-dismiss="fileinput">清除</a>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">姓名：</label>
                <div class="col-sm-8">
                    <input name="xm" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">外文姓：</label>
                <div class="col-sm-8">
                    <input name="wwx" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">外文名：</label>
                <div class="col-sm-8">
                    <input name="wwm" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">身份证：</label>
                <div class="col-sm-8">
                    <select name="ywsfzh" class="form-control m-b">
                        <option value="0">有</option>
                        <option value="1">无</option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">公民身份号：</label>
                <div class="col-sm-8">
                    <input name="gmsfhm" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">证件种类：</label>
                <div class="col-sm-8">
                    <select name="cyzjdm" class="form-control m-b" th:with="type=${@dict.getParamValue('SQJW_ZJZL2')}">
                        <option th:each="dict : ${type}" th:text="${dict.itemText}" th:value="${dict.itemValue}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">证件号码：</label>
                <div class="col-sm-8">
                    <input name="zjhm" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">单位名称：</label>
                <div class="col-sm-8">
                    <input name="dwmc" th:field="*{dwmc}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">职业：</label>
                <div class="col-sm-8">
                    <input name="zy" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">职业类别：</label>
                <div class="col-sm-8">
                    <input name="zylbdm" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">住址：</label>
                <div class="col-sm-8">
                    <input name="zzbm" class="form-control" type="hidden">
                    <div class="input-group">
                        <input class="form-control" name="zz" type="text" onclick="selectAddressTree()" id="treeName" readonly="true">
                        <span class="input-group-addon"><i class="fa fa-search"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">联系方式：</label>
                <div class="col-sm-8">
                    <input name="lxfs" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">重点人员标识：</label>
                <div class="col-sm-8">
                    <input name="zdrybz" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">国家地区：</label>
                <div class="col-sm-8">
                    <input name="gjdq" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">民族：</label>
                <div class="col-sm-8">
                    <select name="mz" class="form-control m-b" th:with="type=${@dict.getParamValue('SQJW_MZ')}">
                        <option th:each="dict : ${type}" th:text="${dict.itemText}" th:value="${dict.itemValue}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">户籍地址：</label>
                <div class="col-sm-8">
                    <input name="hjdz" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">性别：</label>
                <div class="col-sm-8">
                    <select name="xbdm" class="form-control m-b" th:with="type=${@dict.getParamValue('SQJW_XB')}">
                        <option th:each="dict : ${type}" th:text="${dict.itemText}" th:value="${dict.itemValue}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">出生日期：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        <input name="csrq" class="form-control" placeholder="yyyy-MM-dd" type="text">
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">人员类别：</label>
                <div class="col-sm-8">
                    <input name="rylb" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">是否境外人员：</label>
                <div class="col-sm-8">
                    <input name="sfjwry" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">岗位：</label>
                <div class="col-sm-8">
                    <input name="gw" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">标签：</label>
                <div class="col-sm-8">
                    <input name="bq" th:value="${bq}" type="hidden">
                    <input id="labelName" th:value="${labelNames}" class="form-control" type="text" readonly>
                    <div id="tree" class="ztree" style="border: 1px solid #e5e6e7"></div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">登记单位公安机关名称：</label>
                <div class="col-sm-8">
                    <input name="djdwGajgmc" th:field="*{djdwGajgmc}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">登记人姓名：</label>
                <div class="col-sm-8">
                    <input name="djrXm" th:field="*{djrXm}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">登记时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        <input name="djsj" th:value="${#dates.format(unit.djsj, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">信息登记来源_业务类别：</label>
                <div class="col-sm-8">
                    <input name="xxdjlyZaglywlbdm" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">信息登记来源_业务流水号：</label>
                <div class="col-sm-8">
                    <input name="xxdjlyYwlsh" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">信息注销来源_业务类别：</label>
                <div class="col-sm-8">
                    <input name="xxzxlyZaglywlbdm" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">信息注销来源_业务流水号：</label>
                <div class="col-sm-8">
                    <input name="xxzxlyYwlsh" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">数据来源：</label>
                <div class="col-sm-8">
                    <select name="sjly" class="form-control m-b" th:with="type=${@dict.getParamValue('YBSS_SJLY')}">
                        <option th:each="dict : ${type}" th:text="${dict.itemText}" th:value="${dict.itemValue}" th:field="${unit.sjly}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">重点人员类别：</label>
                <div class="col-sm-8">
                    <input name="zdrylb" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">核查人员标志：</label>
                <div class="col-sm-8">
                    <input name="hcrybz" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">重点人员类别名称：</label>
                <div class="col-sm-8">
                    <input name="zdrylbmc" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">互联网审核人：</label>
                <div class="col-sm-8">
                    <input name="hlwshr" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">互联网审核时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        <input name="hlwshsj" class="form-control" placeholder="yyyy-MM-dd" type="text">
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">所属地市：</label>
                <div class="col-sm-8">
                    <input name="ssds" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">所属社区：</label>
                <div class="col-sm-8">
                    <input name="sssq" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">所属网格：</label>
                <div class="col-sm-8">
                    <input name="sswg" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">注销时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        <input name="zxsj" class="form-control" placeholder="yyyy-MM-dd" type="text">
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">注销账号：</label>
                <div class="col-sm-8">
                    <input name="zxr" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">注销时间标志：</label>
                <div class="col-sm-8">
                    <input name="zxsjbz" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">注销原因：</label>
                <div class="col-sm-8">
                    <input name="zxyy" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">更新账号：</label>
                <div class="col-sm-8">
                    <input name="gxzh" class="form-control" type="text">
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: ztree-js" />
    <th:block th:include="include :: jasny-bootstrap-js"/>
    <th:block th:include="include :: datetimepicker-js" />
    <script type="text/javascript">
        var prefix = ctx + "control/staff"
        $("#form-staff-add").validate({
            focusCleanup: true
        });

        $(function() {
            var url = ctx + "control/label/treeData";
            var options = {
                id: "tree",
                url: url,
                check: { enable: true },
                expandLevel: 0,
                onCheck: onCheck
            };
            $.tree.init(options);
        });
        function onCheck() {
            $('input[name="bq"]').val(getChecked('id'));
            $('#labelName').val(getChecked('name'));
        }

        function getChecked(column) {
            var nodes = $._tree.getCheckedNodes(true);
            return $.map(nodes, function (row) {
                if(!row.isParent){
                    return row[column]
                }
            }).join();
        }

        function submitHandler() {
            if ($.validate.form()) {
                save(prefix + "/add", $('#form-staff-add').serialize(),function (res) {
                    if(res.success){
                        $.modal.close();
                        window.parent.parent.$.modal.openTab("从业人员", $.common.setURL("/control/staff"));
                    }
                });
            }
        }

        function save(url, data, callback) {
            var config = {
                url: url,
                type: "post",
                dataType: "json",
                data: data,
                beforeSend: function (request) {
                    request.setRequestHeader("X-Access-Token", storage.get("token"));
                },
                success: function(result) {
                    callback(result);
                }
            };
            $.ajax(config)
        }

        $('#williamYe').on('change.bs.fileinput ', function (e) {
            // 处理自己的业务
            if(this.files[0]){
                const formData = new FormData();
                formData.append('file',this.files[0]);
                $.operate.fileUpload(formData, $('input[name="photo"]'));
            }else{
                $('input[name="photo"]').val("");
            }
        });

        /*新增-选择地址树*/
        function selectAddressTree() {
            var url = prefix + "/selectAddressTree";
            var options = {
                title: '住址选择',
                width: "380",
                url: url,
                callBack: doSubmit
            };
            $.modal.openOptions(options);
        }

        function doSubmit(index, layero){
            var body = layer.getChildFrame('body', index);
            $('input[name="zzbm"]').val(body.find('#treeId').val());
            $("#treeName").val(body.find('#treeName').val());
            layer.close(index);
        }

        $("input[name='csrq']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $("input[name='djsj']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });


        $("input[name='hlwshsj']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $("input[name='zxsj']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });
    </script>
</body>
</html>
